package com.wysql.feign.client;

import com.wysql.common.R;
import com.wysql.common.model.vo.*;
import com.wysql.feign.config.FeignName;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
@FeignClient(value = FeignName.COMMON_API)
public interface CommonFeign {
    @PostMapping(value = "/xxwyspdwgh-system/dict/getAll")
    R<List<SysDictVo>> getAll();

    @PostMapping(value = "/xxwyspdwgh-system/dict/getAllByType")
    R<List<SysDictVo>> getAllByType(@RequestParam("type") String type);

    @PostMapping(value = "/xxwyspdwgh-system/dict/selectYearById")
    String selectYearById(@RequestParam("id") String id);

    /**
     * 获取选项
     *
     * @return 选项
     */
    @PostMapping(value = "/xxwyspdwgh-system/table/getOptionByType")
    List<TableVo.FilterVo> getOptionByType(
            @RequestBody FilterParamVo filterParamVo);

    @PostMapping(value = "/xxwyspdwgh-system/dict/selectDictIdByRemark")
    String selectDictIdByRemark(@RequestParam("remark") String remark, @RequestParam("dictType") String dictType);

    @PostMapping(value = "/xxwyspdwgh-system/table/getByAllByTableName")
    List<SysTableForSqlVo> SysTableForSqlVo(@RequestParam("tableNameRemark") String tableNameRemark);

    @PostMapping(value = "/xxwyspdwgh-system/table/getTableHead")
    R<TableVo> getTableHead(@RequestParam("tableName") String tableName);

    @PostMapping(value = "/xxwyspdwgh-system/table/getTableHeadByName")
    List<SysTableVo> getTableHeadByName(@RequestParam("tableName") String tableName);

    @PostMapping(value = "/xxwyspdwgh-system/table/getByAllByTableNameNoSelect")
    List<SysTableVo> getByAllByTableNameNoSelect(@RequestParam("tableName") String tableName);

    @PostMapping(value = "/xxwyspdwgh-system/dict/save")
    R<String> save(@RequestBody SysDictVo sysDictVo);

    @PostMapping(value = "/xxwyspdwgh-system/dict/getYear2021")
    R<List<OptionVo>> getYear2021();
}
